package nl.boelen.game.net.packet;

public class Packet21GetChunk extends Packet {

    private static final int packetNumber = 21;
    private int xChunk;
    private int yChunk;

    public Packet21GetChunk(byte[] data) {
        super(packetNumber);
        String[] datas = readData(data).split(":");
        this.xChunk = Integer.parseInt(datas[0]);
        this.yChunk = Integer.parseInt(datas[1]);
    }

    public Packet21GetChunk(int x, int y) {
        super(packetNumber);
        this.xChunk = x;
        this.yChunk = y;
    }

    @Override
    public byte[] getData() {
        return (packetNumber + this.xChunk + ":" + this.yChunk).getBytes();
    }

    public int getXChunk() {
        return xChunk;
    }

    public int getYChunk() {
        return yChunk;
    }
}